/*
 * Copyright (c) 2017. All  rights reserved.
 * 项目名：microservice-base
 * 文件名：User.java
 * Date  ：17-11-15 下午6:36
 * Author：abin
 *
 */

package com.microservice.base.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/11/15.
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User implements Serializable {

    private static final long serialVersionUID = 5080651681033718786L;
    //userid
    @ApiModelProperty(value = "用户编号", notes = "用户编号", allowEmptyValue = false, required = false)
    private String userId;
    @NotBlank
    @ApiModelProperty(value = "学校编号", notes = "学校编号", allowEmptyValue = false, required = true)
    private String schoolCode;
    @ApiModelProperty(value = "登录名", notes = "登录名", allowEmptyValue = false, required = false)
    private String loginName;
    @ApiModelProperty(value = "连接表的id", notes = "如果用户是老师那么就是教师表的id，如果是学生那么就是学生表的id", allowEmptyValue = false, required = false)
    private String joinId;
    @ApiModelProperty(value = "真实姓名", notes = "真实姓名", allowEmptyValue = false, required = false)
    private String realName;
    @ApiModelProperty(value = "IM头像", notes = "IM头像", allowEmptyValue = false, required = false)
    private String avatar;
    @ApiModelProperty(value = "IM个性签名", notes = "IM个性签名", allowEmptyValue = false, required = false)
    private String sign;
    @JsonIgnore
    @ApiModelProperty(value = "密码", notes = "密码", allowEmptyValue = false, required = false)
    private String password;
    @ApiModelProperty(value = "用户类型：管理员0、操作员1、老师2、学生3、家长4", notes = "用户类型：管理员0、操作员1、老师2、学生3、家长4", allowEmptyValue = false, required = false)
    private String userType;
    @ApiModelProperty(value = "登录长度", notes = "登录长度", allowEmptyValue = false, required = false)
    private Long loginCount;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "最后登录时间", notes = "最后登录时间", allowEmptyValue = false, required = false)
    private Date lastLoginTime;
    @ApiModelProperty(value = "最后登录的ip", notes = "最后登录的ip", allowEmptyValue = false, required = false)
    private String lastLoginIp;
    @NotEmpty
    @Length(min = 0, max = 20)
    @ApiModelProperty(value = "一卡通号", notes = "一卡通号", allowEmptyValue = false, required = false)
    private String icardNo;
    @ApiModelProperty(value = "一卡通物理编号", notes = "一卡通物理编号", allowEmptyValue = false, required = false)
    @Length(min = 0, max = 50)
    private String cardHex;
    @ApiModelProperty(value = "账户余额", notes = "账户余额", allowEmptyValue = false, required = false)
    private Double userBalance;
    @ApiModelProperty(value = "卡类型", notes = "卡类型", allowEmptyValue = false, required = false)
    private String cardType;
    @ApiModelProperty(value = "//卡片状态 0正常，1挂失，2停用，3冻结，99未办卡", notes = "//卡片状态 0正常，1挂失，2停用，3冻结，99未办卡", allowEmptyValue = false, required = false)
    @Length(min = 0, max = 10)
    private String cardStatus;
    @ApiModelProperty(value = "有效截止时间", notes = "有效截止时间", allowEmptyValue = false, required = false)
    @JsonFormat(pattern = "yyyy/MM/dd", timezone = "GMT+8")
    private Date invalidTime;
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<Role> roles;
    @JsonIgnore
    private List<Menu> menus;
    @JsonIgnore
    private Map<String, Menu> menuMap;
    @JsonIgnore
    private String[] roleIds;
    @Length(min = 0, max = 10)
    @ApiModelProperty(value = "状态  0：禁用   1：正常 2：首次登录须修改密码 3：禁止修改密码'", notes = "状态  0：禁用   1：正常 2：首次登录须修改密码 3：禁止修改密码'", allowEmptyValue = false, required = false)
    private String status;
    @Length(min = 0, max = 255)
    @ApiModelProperty(value = "备注", notes = "备注", allowEmptyValue = false, required = false)
    private String remarks;
    @ApiModelProperty(value = "删除状态", notes = "删除状态", allowEmptyValue = false, required = false)
    private String deleted;
    @ApiModelProperty(value = "创建者", notes = "创建者", allowEmptyValue = false, required = false)
    private String createUser;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "创建时间", notes = "创建时间", allowEmptyValue = false, required = false)
    private Date createTime;
    @ApiModelProperty(value = "更新人", notes = "更新人", allowEmptyValue = false, required = false)
    private String updateUser;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "更新时间", notes = "更新时间", allowEmptyValue = false, required = false)
    private Date updateTime;
    @ApiModelProperty(value = "同步标志位", notes = "同步标志位", allowEmptyValue = false, required = false)
    private String syncFlag;

}